<?php

/**
 * @author aisyah
 * @copyright 2012
 */

include_once("database.php");
include_once("blog.php");



class Blog_Dao {    

    
    var $content;

    var $db;
    var $blog;   
    
    function __construct(Database $class_db){
        $this->db=$class_db;
    }    
    
    //fungsi menghitung rating
    function get_star($id){
        
        $query = "";
        
    }
    
    //fungsi memotong karakter untuk tampilan list blog
    function list_content($content, $id=null){
        
        if(strlen($content)>=300){
            $this->content = substr($content, 0, 299);
            $this->content .= " ... <a href='blog_view.php?modul=tampil&id=$id'>Selengkapnya</a>";
        }else{
            $this->content = $content;
        }
        
        return $this->content;
    }
    
    //fungsi ini belum selesai
    function content_length($content){
        
        if(str_word_count($content)<100){
            return false;
        }else{
            $this->content=$content;
            return true;
        }
    }
    
    
}
